package cn.brian.modular.sys.controller;

import cn.brian.modular.sys.model.SysUser;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author huangjinghua
 */
@RestController
@RequestMapping(value = "/says", method = RequestMethod.GET)
@Api(value="/says",tags = {"用户管理接口"})// Swagger-UI 描述在类上面，可以做分组。
public class SysUserController {
    /**
     * 根据用户名说hello
     * @param name
     * @return
     */
    @ApiOperation(value="根据用户名称查询", notes="根据url的name来say hello!")
    @ApiImplicitParam(name = "name", value = "用户名称", required = true, dataType = "String", paramType = "path")
    @RequestMapping(value = "/hello",method = RequestMethod.GET)
    public String hello(String name){
        return name+" hello";
    }


    @ApiOperation(value="根据用户实体查询", notes="根据url的name来say hello!")
    @ApiResponses({
            @ApiResponse(code = 10000, message = "xxx成功"),
            @ApiResponse(code = 130001, message = "员工假期余额模板不存在，请检查"),
            @ApiResponse(code = 10301, message = "<b>很抱歉，导入失败！共 3 条数据格式不正确，错误如下："),
            @ApiResponse(code = 99999, message = "xxxx失败")
    })
    @RequestMapping(value = "/get",method = RequestMethod.GET)
    public String queryByEntity(@ModelAttribute SysUser sysUer){
        return  sysUer.getUserId()+" hello   "+sysUer.getUserName()+" hello";
    }
}